﻿using Illinois.Core.Fakes;
using Illinois.Core.Services;
using NUnit.Framework;

namespace Illinois.Core.Test.Services
{
  [TestFixture]
  public class Test_UserService
  {
    private FakeUserRepository _repo;
    private UserService _service;
    private const string Password = "test"; // md5: 098f6bcd4621d373cade4e832627b4f6

    [SetUp]
    public void Init()
    {
      _repo = new FakeUserRepository();
      _service = new UserService(_repo);
    }

    [Test]
    public void The_User_Mattia_Richetto_Belongs_To_ARENA()
    {
      var user = _service.GetUser("mattia.richetto", Password);
      Assert.AreEqual("ARENA", user.Project.Name);
    }

    [Test]
    public void The_User_Mariaelisa_Cardone_Belongs_To_EBS()
    {
      var user = _service.GetUser("mariaelisa.cardone", Password);
      Assert.AreEqual("EBS", user.Project.Name);
    }

    [Test]
    public void The_Md5_Of_Test()
    {
      Assert.AreEqual("098f6bcd4621d373cade4e832627b4f6", UserService.GetMd5Hash("test"));
    }
  }
}
